package com.aurora.app.entity;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.aurora.app.enums.ChatMessageType;
import com.aurora.app.enums.UtTsType;
import com.aurora.base.entity.BaseEntity;

/**
 * 记录一个聊天框的信息
 * @author yongjiang.lin
 *
 */
@Entity
@Table(name="tb_chat_group")
public class ChatGroup extends BaseEntity {

	//关联的闲置物品
	private Thing thing;
	//关联的帮帮任务
	private Help help;
	//关联的物语
	private ThingStory thingStory;
	//物品联系的外人
	private User user;
	//类型
	private UtTsType utTsType;
	
	@ManyToOne(cascade = {CascadeType.REFRESH}, optional = true, fetch = FetchType.LAZY)
	@JoinColumn(name = "f_thing_id")
	public Thing getThing() {
		return thing;
	}
	public void setThing(Thing thing) {
		this.thing = thing;
	}
	
	@Enumerated(EnumType.ORDINAL)
	@Column(name = "f_type")
	public UtTsType getUtTsType() {
		return utTsType;
	}
	public void setUtTsType(UtTsType utTsType) {
		this.utTsType = utTsType;
	}
	
	@ManyToOne(cascade = {CascadeType.REFRESH}, optional = true, fetch = FetchType.LAZY)
	@JoinColumn(name = "f_user_id")
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	
	@ManyToOne(cascade = {CascadeType.REFRESH}, optional = true, fetch = FetchType.LAZY)
	@JoinColumn(name = "f_help_id")
	public Help getHelp() {
		return help;
	}
	public void setHelp(Help help) {
		this.help = help;
	}
	
	@ManyToOne(cascade = {CascadeType.REFRESH}, optional = true, fetch = FetchType.LAZY)
	@JoinColumn(name = "f_story_id")
	public ThingStory getThingStory() {
		return thingStory;
	}
	public void setThingStory(ThingStory thingStory) {
		this.thingStory = thingStory;
	}
}
